{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "%load_ext autoreload\n",
    "%autoreload 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tensorflow as tf\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from path_explain import set_up_environment\n",
    "from contextual_decomposition import ContextualDecompositionExplainerTF"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "set_up_environment(visible_devices='0')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "x = np.random.randn(100, 2).astype(np.float32)\n",
    "y = x[:, 0] + np.random.randn(100) * 0.1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x7f41a49f73d0>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAD4CAYAAADxeG0DAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAV/0lEQVR4nO3df4jcd53H8dd7t2NvouK0NJxk2jSBk5TGeF0yaCV/HK1i6p2ta3Je7akgCvnnhGvxIslVriknJBBOT1CQcIqIoUZNulqixEp6lCumuNvdmsYk4nk07VRwpVl/7Wonm/f9sTub2Znvd+b73fnOfL/fmecDCs3s7Hc+DvrKx/fn/fl8zN0FAMivkbQHAADoDkEOADlHkANAzhHkAJBzBDkA5Nx1aXzoTTfd5Js2bUrjowEgt6ampn7j7uubX08lyDdt2qTJyck0PhoAcsvMXgx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co8gB4CcG/ogN7PDZnbBzH5qZo+bWSntMaXJzD5oZufM7KqZDXV7mZndY2YXzewXZrYv7fGkzcy+ama/NrMX0h5LVpjZLWb2lJn9bPl/N/+cxjiGPsglPSnpre7+Nkk/l7Q/5fGk7QVJuyQ9nfZA0mRmo5K+JOm9km6X9ICZ3Z7uqFL3NUn3pD2IjLki6VPufrukOyX9Uxr/PRn6IHf3H7r7leU/npF0c5rjSZu7n3f3i2mPIwPeLukX7v5Ld39N0jclvT/lMaXK3Z+W9Gra48gSd/+Vuz+3/O+/l3ReUt9vvxn6IG/ycUk/SHsQyISypJca/vyyUvgfKPLDzDZJGpP0bL8/O1dXva2Vmf1I0psDfvSwu393+T0Pa+n/Jh3t59jSEOX7ABCdmb1B0nFJD7r77/r9+UMR5O7+7nY/N7OPSXqfpHf5EDTWd/o+IEmqSrql4c83L78GrGJmBS2F+FF3P5HGGIa+tGJm90j6tKT73H0+7fEgM34i6S1mttnMXifpQ5K+l/KYkDFmZpK+Ium8u38urXEMfZBL+qKkN0p60sxmzOzLaQ8oTWb2ATN7WdI7JZ00s1NpjykNywvgn5R0SksLWN9y93PpjipdZvaYpB9L2mJmL5vZJ9IeUwbskPRRSXcv58eMmf1tvwfBFn0AyDlm5ACQcwQ5AOQcQQ4AOUeQA0DOEeQAkHMEOQDkHEEOADn3/1NKr9yYNai2AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(x[:, 0], y)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "model = tf.keras.models.Sequential()\n",
    "model.add(tf.keras.layers.Input(shape=(2,)))\n",
    "model.add(tf.keras.layers.Dense(8))\n",
    "model.add(tf.keras.layers.Activation(tf.keras.activations.relu))\n",
    "model.add(tf.keras.layers.Dense(1))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<tf.Variable 'dense/kernel:0' shape=(2, 8) dtype=float32, numpy=\n",
       "array([[-1.4963406e-01, -4.7498208e-01, -7.4334443e-02, -6.5172344e-01,\n",
       "        -4.4775996e-01, -1.4514381e-01,  2.3896384e-01,  7.4586999e-01],\n",
       "       [-6.6887689e-01, -7.2146016e-01, -5.2559376e-04, -5.9159327e-01,\n",
       "        -2.2981542e-01, -5.4351085e-01,  1.6322142e-01,  4.9301279e-01]],\n",
       "      dtype=float32)>"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.layers[0].weights[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model: \"sequential\"\n",
      "_________________________________________________________________\n",
      "Layer (type)                 Output Shape              Param #   \n",
      "=================================================================\n",
      "dense (Dense)                (None, 8)                 24        \n",
      "_________________________________________________________________\n",
      "activation (Activation)      (None, 8)                 0         \n",
      "_________________________________________________________________\n",
      "dense_1 (Dense)              (None, 1)                 9         \n",
      "=================================================================\n",
      "Total params: 33\n",
      "Trainable params: 33\n",
      "Non-trainable params: 0\n",
      "_________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "model.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Train on 100 samples\n",
      "Epoch 1/10\n",
      "100/100 [==============================] - 0s 3ms/sample - loss: 1.4285\n",
      "Epoch 2/10\n",
      "100/100 [==============================] - 0s 41us/sample - loss: 0.8153\n",
      "Epoch 3/10\n",
      "100/100 [==============================] - 0s 44us/sample - loss: 0.5439\n",
      "Epoch 4/10\n",
      "100/100 [==============================] - 0s 42us/sample - loss: 0.3674\n",
      "Epoch 5/10\n",
      "100/100 [==============================] - 0s 40us/sample - loss: 0.2642\n",
      "Epoch 6/10\n",
      "100/100 [==============================] - 0s 40us/sample - loss: 0.1996\n",
      "Epoch 7/10\n",
      "100/100 [==============================] - 0s 40us/sample - loss: 0.1457\n",
      "Epoch 8/10\n",
      "100/100 [==============================] - 0s 40us/sample - loss: 0.1224\n",
      "Epoch 9/10\n",
      "100/100 [==============================] - 0s 40us/sample - loss: 0.0991\n",
      "Epoch 10/10\n",
      "100/100 [==============================] - 0s 40us/sample - loss: 0.0884\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<tensorflow.python.keras.callbacks.History at 0x7f0790140050>"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model.compile(optimizer=tf.keras.optimizers.SGD(learning_rate=0.1),\n",
    "              loss=tf.keras.losses.MeanSquaredError())\n",
    "model.fit(x, y, batch_size=50, epochs=10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "y_pred = model.predict(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x7f074c63ef90>"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD4CAYAAADvsV2wAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAbHklEQVR4nO3df4xc1XUH8O/X68FZ0yhLghtgbGNXQU6dOGbFyARtpQZDY0Mo3tghwYmq0KRyIxWlTSOnS13ll6KylZWmaaFNVyQKURE/GmBxaqcb6FLR0pAyZm3AMU5cN4k90LCATSJ2g9fr0z9mZnd29r2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aHzexI0uNI0AYAR83smJmdBnAPgC0JjykxZvYYgFeSHocLzOwFM3uq8vMvARwG4OQpTAr4rfsYgO8mPQhJTB7A8ZrHJ+Do/9SSHJKrAPQC+EGyI/HWcUccBkXyEQAXeLy0y8weqlyzC+WvbXfFOba4tfK7EBFvJH8NwP0A/sTMfpH0eLxkPuCb2dWNXid5E4DrAFxlHb5podnvIuNKAFbUPF5eeU4EJHMoB/u7zOyBpMfjRymdBkhuBvAZANeb2UTS45FEPQngEpKrSZ4D4EYAexIekziAJAF8HcBhM/vrpMfTiAJ+Y7cBeCOAh0keIPm1pAeUFJLvJ3kCwBUA9pIcSXpMcaos3t8MYATlRbn7zOxQsqNKDsm7AXwfwBqSJ0h+POkxJagPwO8B2FiJEwdIXpv0oLyotYKISEZohi8ikhEK+CIiGaGALyKSEQr4IiIZoYAvIpIRCvgiIhmhgC8ikhH/D1tFm1RkRT14AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(y, y_pred)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "explainer = ContextualDecompositionExplainerTF(model)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 2/2 [00:00<00:00, 285.00it/s]\n",
      "100%|██████████| 2/2 [00:00<00:00, 347.92it/s]\n"
     ]
    }
   ],
   "source": [
    "beta_attributions, gamma_attributions = explainer.attributions(inputs=x,\n",
    "                                                               batch_size=50,\n",
    "                                                               output_indices=0,\n",
    "                                                               verbose=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x7f074c62ac50>"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD4CAYAAADvsV2wAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAZsUlEQVR4nO3df4wc9XnH8ffjZU3WJM054Vrw4oupgkxNCFhcDRH9AwiNDSHgkBBwSBWaVJaqojZSeqkRCEKUCrdWG0UFNbUIStIgCCJwQHF6gCCiJYVyztkYB5w4NGCvUXECR0p8hLvz0z921+ztzeyPm9md2Z3PS7LYnZ3b+Wqxn517vs/3+Zq7IyIi/W9R0gMQEZHuUMAXEckIBXwRkYxQwBcRyQgFfBGRjDgq6QE0cuyxx/qKFSuSHoaISM/Yvn37L919MOi1VAf8FStWMD4+nvQwRER6hpm9GPaaUjoiIhmhgC8ikhEK+CIiGaGALyKSEbEEfDO7zcxeMbNnQ14/x8xeN7MdlT/Xx3FdERFpXVxVOt8Cbga+0+Cc/3D3i2K6noiItCmWgO/uj5vZijjeS0SkX4xOlNgytocDk1MsGygwsnYl61cXExtPN+vwP2RmO4EDwF+7++6gk8xsI7ARYGhoqIvDExGJz+hEiWvu2cXU9CwApckprrlnF0Bo0O/0F0S3Jm1/DLzP3U8D/gkYDTvR3be6+7C7Dw8OBi4WExFJvS1je44E+6qp6Vm2jO0JPL/6BVGanMJ5+wtidKIU25i6EvDd/dfu/kbl8TYgb2bHduPaIiJJODA51dbxdr8gFqIrAd/MjjMzqzxeU7nur7pxbRGRJCwbKLR1vN0viIWIJYdvZncA5wDHmtl+4AYgD+Du3wA+Cfy5mc0AU8AVrr0VRaSPnXvyIN998qV5x1e8t8DZmx+dl6dfNlCgFBDcw74gFiKuKp0NTV6/mXLZpohIJjz2/MHA4z/6+atU73ZrJ3JH1q6cM8kLUMjnG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JSoQjsq3m+n4T/MUt6mdkKYDXwVJLj6LstDhfCzB4Bjgt46Vp3v69yzrWUf0W7vZtjS0Irn4eItMbM3gl8H/iCu/86ybEo4APufn6j183sKuAi4MOegYULzT4PAaAELK95fkLlmMgRZpanHOxvd/d7kh6PUjpNmNk64EvAxe5+KOnxSGo8DZxkZiea2WLgCuD+hMckKWJmBnwTeM7d/zHp8YACfituBt4FPGxmO8zsG0kPKElm9nEz2w98CHjQzMaSHlMSKhP5VwNjlCfj7nL33cmOKllmdgfwX8BKM9tvZp9PekwJOxv4E+C8SuzYYWYXJjkgtVYQEckI3eGLiGSEAr6ISEYo4IuIZIQCvohIRijgi4hkhAK+iEhGKOCLiGTE/wNqIoMyXG3uygAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(x[:, 0], beta_attributions[:, 0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x7f074c59c6d0>"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAD4CAYAAADxeG0DAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAVDElEQVR4nO3df4gkZ53H8c93J632RnESshB3sskGTiaXuNGFxkT2jyOr3MaLP8YFPffwQBTyzwmnhJFdcpAIgQwMHveHgiyc+EdCTHLZjLmLMkZWCAQ358zNbjZ7yUgwJJtewZVk4p3bZ3pnv/fHTk+6e6qqq7qqu6q63y8QnOrprqJxP/P4fb7P85i7CwBQX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wjc/SV3X837OXL2cUmvuPtv3f0dST+W9PmcnylX7v6spDfzfo6icPffuft/bfz3/5H0kqRcT7wZ2yDv8jVJP8v7IVAIU5LOtv38hnL+R4riMrPdkvZKej7P5yjVUW9JmdkvJF0b8NK97v6Tjd+5V5f/r9LDw3y2vMT5TgD0Zmbvl/SEpG+6+x/zfJaRDnJ3/1TU62b2VUmfkfRJH5OG+l7fCVSXtKvt5+s2rgGbzKyiyyH+sLsfy/t5xra0YmZ3Svq2pM+5+4W8nweF8WtJHzazG83sPZK+LOmpnJ8JBWJmJulfJb3k7v+c9/NIYxzkkr4n6QOSnjGzk2b2g7wfKG9m9gUze0PSJyQ9bWaLeT/TsG1MgH9D0qIuT2I95u5n8n2qfJnZI5J+JWnazN4ws6/n/Uw52yfp7yXt38iOk2b2N3k+EEv0AaDkxnlEDgAjgSAHgJIjyAGg5AhyACg5ghwASo4gB4CSI8gBoOT+H/PZEi2Zu1YMAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(x[:, 0], beta_attributions[:, 0] - gamma_attributions[:, 0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x7f074c4fa790>"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD4CAYAAADvsV2wAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAX40lEQVR4nO3df4xsZX3H8c/3LktdauuC3FBYfiYll4BX2bBFDGkriF38UdiKLVCx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y5Wt+UX84XP+n8AqZ6AJ+iz+V9PWiG4HMxiQ91fR4twILFLExs+MljUv6r2Jbkj8zGzKzXVpbVPJOdy/8PXZcLbOK2i3p7O5fqW9zhdYuLa8fZNvykuU9AmVmZq+VdIukj7j7/xbdnry5+15Jp9bHCW8zsze4e6FjM0EG/HZLOkuSmX1A0rslvc0rOhGh03sMVE3SMU2Pj64/h4oxs2GtBfvr3f3WotvTT+6+bGb3aG1sptCAH11Kx8zOlfRXks5z95eKbg+68oCkE83shPqy2xdpbYluVIiZmaTPSXrU3f+h6Pb0g5ltblQAmtmIpLdLeqzYVkUY8CX9k6Rfk3Snme0ys38uukF5M7M/MLPdkt4i6XYzmyu6TXmoD7Z/WNKc1gb6bnT3R9r/V9ViZv8u6T5JW8xst5l9sOg29cGZkt4v6ez6d3CXmb2z6Ebl7EhJ95jZQ1rrqNzp7l8ruE0srQAAsYixhw8AUSLgA0AkCPgAEAkCPgBEgoAPAJEg4ANAJAj4ABCJ/wfpzy98QmsNnAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(x[:, 1], beta_attributions[:, 1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 2/2 [00:00<00:00, 328.10it/s]\n",
      "100%|██████████| 2/2 [00:00<00:00, 321.54it/s]\n",
      "100%|██████████| 2/2 [00:00<00:00, 343.20it/s]\n",
      "100%|██████████| 2/2 [00:00<00:00, 345.28it/s]\n"
     ]
    }
   ],
   "source": [
    "beta_interactions, gamma_interactions = explainer.interactions(inputs=x,\n",
    "                                                               batch_size=50,\n",
    "                                                               output_indices=0,\n",
    "                                                               verbose=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 1.0077835 , -0.05744376], dtype=float32)"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "beta_attributions[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.00778353,  0.83217013],\n",
       "       [ 0.83217013, -0.05744376]])"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "beta_interactions[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "interactions = beta_interactions - beta_attributions[:, :, np.newaxis] - beta_attributions[:, np.newaxis, :]\n",
    "interactions[:, np.arange(2), np.arange(2)] = beta_attributions"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[ 1.00778353, -0.11816964],\n",
       "       [-0.11816964, -0.05744376]])"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "interactions[0]"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
